<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/2/14
 * Time: 20:48
 */

namespace App\Http\Controllers\MiniProgram;


use App\Http\Logics\MiniProgram\ArticleLogic;
use App\Http\Traits\ArticleTrait;
use App\Http\Controllers\BaseController;
class ArticleController extends BaseController
{
    use ArticleTrait;

    /**
     * @SWG\Get(
     *     path="/article/list",
     *     tags={"Article"},
     *     description="getArticleList",
     *     operationId="通过标签ID获取咖啡馆列表",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="分页大小",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getArticleList()
    {
        $limit = $this->limit;
        $data = [
            'limit' => $limit
        ];
        $response = ArticleLogic::getArticleList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/article/detail",
     *     tags={"Article"},
     *     description="getArticleDetail",
     *     operationId="获取文章详情",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="article_id",
     *         in="query",
     *         description="文章ID",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getArticleDetail()
    {
        $article_id = $this->article_id;
        $data = [
            'article_id' => $article_id
        ];
        $response = ArticleLogic::getArticleDetail($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}